home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #3 / Amiga Plus CD - 2002 - No. 03.iso / AmigaPlus / Tools / Development / renderlib40 / src / rnd_histogram.h < prev    next >
Encoding:
C/C++ Source or Header  |  2002-12-19  |  1.4 KB  |  59 lines

  1.  
  2. #ifndef _RND_HISTO_H
  3. #define _RND_HISTO_H
  4.  
  5. #include <utility/tagitem.h>
  6. #include <exec/memory.h>
  7. #include "rnd_palette.h"
  8.  
  9. #define HSTYPE_MASK    15
  10. #define RNDTREEMEMBLOCK_NUMNODES    64
  11.  
  12. struct RNDHistoEntry
  13. {
  14.     ULONG rgb;
  15.     ULONG count;
  16. };
  17.  
  18. struct RNDTreeNode
  19. {
  20.     struct RNDTreeNode *left, *right;
  21.     struct RNDHistoEntry entry;
  22. };
  23.  
  24. struct RNDTreeMemBlock
  25. {
  26.     struct RNDTreeMemBlock *next;
  27.     ULONG free;        /* number of remaining free nodes in this block */
  28.     struct RNDTreeNode nodes[RNDTREEMEMBLOCK_NUMNODES];
  29. };
  30.  
  31. typedef struct Histogram
  32. {
  33.     struct SignalSemaphore lock;
  34.     APTR rmh;
  35.     APTR table;
  36.     struct RNDTreeMemBlock *memlist;
  37.     struct RNDTreeNode *root;
  38.     ULONG numcolors;
  39.     ULONG numpixels;
  40.     ULONG rgbmask;
  41.     UWORD type;
  42.     UWORD bitspergun;
  43.  
  44. } RNDHISTO;
  45.  
  46.  
  47. LIBAPI RNDHISTO *CreateHistogramA(struct TagItem *tags);
  48. LIBAPI void DeleteHistogram(RNDHISTO *h);
  49. LIBAPI ULONG AddRGB(RNDHISTO *h, ULONG rgb, ULONG count);
  50. LIBAPI ULONG QueryHistogram(RNDHISTO *h, Tag tag);
  51. LIBAPI ULONG AddRGBImageA(RNDHISTO *h, ULONG *rgb, UWORD width, UWORD height, struct TagItem *tags);
  52. LIBAPI ULONG AddChunkyImageA(RNDHISTO *histogram, UBYTE *chunky, UWORD width, UWORD height, RNDPAL *palette, struct TagItem *tags);
  53. LIBAPI struct RNDHistoEntry **CreateHistogramPointerArray(RNDHISTO *histogram);
  54. LIBAPI ULONG CountRGB(RNDHISTO *h, ULONG rgb);
  55. LIBAPI ULONG CountHistogram(RNDHISTO *h);
  56. LIBAPI ULONG AddHistogramA(RNDHISTO *dst, RNDHISTO *src, struct TagItem *tags);
  57.  
  58. #endif
  59.